package com.wejoy.video.middle.station.admin.controller.common;

import com.wejoy.video.middle.station.data.service.common.IDictService;
import com.wejoy.video.middle.station.data.vo.RespJSON;
import com.wejoy.video.middle.station.data.vo.dict.DictVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 字典接口
 */
@RestController
@RequestMapping("/common/dict")
public class DictController {
    @Autowired
    private IDictService dictService;

    /**
     * 统计枚举名称获得枚举的数据
     *
     * @param name 枚举名称, 枚举文件必须在com.wejoy.video.middle.station.data.enums.dict包下
     * @return
     */
    @RequestMapping("/getDictDataByName/{name}")
    public RespJSON getDictDataByName(@PathVariable String name) {
        List<DictVO> dictData = dictService.getDictData(name);
        return RespJSON.success(dictData);
    }
}
